package com.zxy.ziems.server.constant.enums;

public enum DeviceStatusDictItemEnum {

    RUNNING("running", "运行中"),
    STOP("stop", "停机");

    private final String code;
    private final String value;

    private DeviceStatusDictItemEnum(final String code, final String value) {
        this.code = code;
        this.value = value;
    }

    public static Integer getOnlineStatus(String status) {
        return status.equals(RUNNING.code()) ? 1 : 0;
    }
    public static String getOnlineStatusStr(Integer status) {
        return status == 1 ? RUNNING.code() : STOP.code();
    }

    public String code() {
        return this.code;
    }

    public String value() {
        return this.value;
    }
}
